package com.action;

import java.util.Locale;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.Globals;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

import com.dao.GrantVerifyDAO;
import com.info.UserInfo;
import com.util.GrantVerify;
import com.util.BuildMessages;
import com.util.CommonTools;

/**
 * �û���¼����ز���
 * 
 * @author luanzhe
 * @since 2006-05-15
 * 
 */
public class LocaleAction extends Action {

	/**
	 * Method execute
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DynaActionForm actionForm = (DynaActionForm) form;
		try {
			HttpSession session = request.getSession();
			if(actionForm.get("language").equals("en")){
				session.setAttribute(Globals.LOCALE_KEY,Locale.ENGLISH); 
				session.setAttribute("language", "en");
				
			}
			else if(actionForm.get("language").equals("zh")){
				session.setAttribute(Globals.LOCALE_KEY,Locale.CHINESE);
				session.setAttribute("language", "zh");
			    
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
	
		}
		return mapping.findForward("success");
	}

}
